UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bqP8Z5rY4QEi7q+TkUS5VOm/Gb/Vm8+c87ulW9Pbdfg=' 
WHERE 
  key_id = 'd0df6321f77577d714b769e9a9367b9203a28d362c514535b58e9c7e3e0a312a' 
  AND (
    token = 'bqP8Z5rY4QEi7q+TkUS5VOm/Gb/Vm8+c87ulW9Pbdfg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024