UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A1q/cJrlEfmQujNwJhv1EUseZWQBbOaMFz515IrZqb8=' 
WHERE 
  key_id = '4d966b22215c5a0e905bbaf23fbdd31b9b90d44be1d03143c6124f994c93d81e' 
  AND (
    token = 'A1q/cJrlEfmQujNwJhv1EUseZWQBbOaMFz515IrZqb8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027