UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KeHcfestz5H0DNqpJExHRoWovavn7tUn99QlL+K0q8I=' 
WHERE 
  key_id = '95a0071a1be95c339f978339e692262e009671b9078dbed449428c5e8f132ac3' 
  AND (
    token = 'KeHcfestz5H0DNqpJExHRoWovavn7tUn99QlL+K0q8I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027