UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Evol47i5GTymnexECtSeuZjcK1f/eHlkRmLZthfBBBA=' 
WHERE 
  key_id = 'd4dd5035c28521282a8658934fccf3668b9b84120757dfea19131d61d23ee349' 
  AND (
    token = 'Evol47i5GTymnexECtSeuZjcK1f/eHlkRmLZthfBBBA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039