UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CL1xxLVfWu6RoXkNurG+oJSE2lIOvVK949ysp9ckUVE=' 
WHERE 
  key_id = 'c737d3eece29e083dfe7a348efb72e770fcf23e53d207cde51fa871df00e643d' 
  AND (
    token = 'CL1xxLVfWu6RoXkNurG+oJSE2lIOvVK949ysp9ckUVE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037