UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'An5JjcimPdqcfMoS245ppd4L9udA8ma/jPkeWQJTV84=' 
WHERE 
  key_id = '58ac356482d736267f5457e6664826938ecd36647c9dcea06f40d12eb12914cb' 
  AND (
    token = 'An5JjcimPdqcfMoS245ppd4L9udA8ma/jPkeWQJTV84=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037