UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jFFWvKH018YNpCyNLlbCT4BiGEa9xqSUn5mAw6p2W6k=' 
WHERE 
  key_id = '74c7e65b5017d08dea0b34fb544edaae29414c644b8064ced611d6c4647fac93' 
  AND (
    token = 'jFFWvKH018YNpCyNLlbCT4BiGEa9xqSUn5mAw6p2W6k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023