UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U9Rx1MbNCwbEIEs/btS8ad5wcqx3fs0BPaUm0x9Evuc=' 
WHERE 
  key_id = '4c67130cff8461609f5502beb1fd2046b95f8c2184a252abcd4fa59c59030bd5' 
  AND (
    token = 'U9Rx1MbNCwbEIEs/btS8ad5wcqx3fs0BPaUm0x9Evuc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029