UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aowDoBwvLgqg0wthkwJDg2qYXlHP54omByoTMkqAfEk=' 
WHERE 
  key_id = '5ef4a9cc06148d0d910031993e9c0dd7c56cfa9a6daefc79a7aceaff71b2a507' 
  AND (
    token = 'aowDoBwvLgqg0wthkwJDg2qYXlHP54omByoTMkqAfEk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053