UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MO8lxv03n41HdA9y0bqM5/2mRMhp3JjWLXE+x5hq1Ng=' 
WHERE 
  key_id = '5738b59a4f457c73d862b16c004186f6dc492ad4a2b0dcbeadc673fb36c3ac1b' 
  AND (
    token = 'MO8lxv03n41HdA9y0bqM5/2mRMhp3JjWLXE+x5hq1Ng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056