UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'USooL+DFDkqLUL4TXYFJOpyjYpCIOovBuySY7XZR7Ys=' 
WHERE 
  key_id = '54f23da1c55c62f798f13a83564d23701be22314ddb94a90c09151c19ee637e9' 
  AND (
    token = 'USooL+DFDkqLUL4TXYFJOpyjYpCIOovBuySY7XZR7Ys=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030