UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O/hWeN1RtDuS2tTsKZ9cHQxgfvZ+da/vz6eBmIxKWYo=' 
WHERE 
  key_id = '8828cb9fe51813cff4838273f06fa18b79c2b92095b09c4160291487b806b706' 
  AND (
    token = 'O/hWeN1RtDuS2tTsKZ9cHQxgfvZ+da/vz6eBmIxKWYo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040