UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w+YofLq150E8xgzXLQDJ4QF89lYdrWJfWgg5qpzGj48=' 
WHERE 
  key_id = '163d3bb0b73a88203caefe7a93e7de901c176bce8d0c8f21adf085d32a472c18' 
  AND (
    token = 'w+YofLq150E8xgzXLQDJ4QF89lYdrWJfWgg5qpzGj48=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058